import 'package:flutter/material.dart';

import 'app_styles.dart';

class ButtonRow extends StatelessWidget {
  const ButtonRow({super.key, required this.onSavePressed});

  final void Function() onSavePressed;

  @override
  Widget build(BuildContext context) {
    final localizations = MaterialLocalizations.of(context);

    return Row(
      mainAxisAlignment: MainAxisAlignment.spaceBetween,
      mainAxisSize: MainAxisSize.max,
      children: [
        const SizedBox(width: 14,),
        Expanded(
          child: TextButton(
            onPressed: () {
              Navigator.of(context).pop<DateTime>();
            },
            style: TextButton.styleFrom(
              foregroundColor: context.colorScheme.primary,
              shape: RoundedRectangleBorder(
                borderRadius: BorderRadius.circular(24.0),
                side: BorderSide(color: context.colorScheme.primary, width: 1.0),
              ),
            ),
            child: Text(
              localizations.cancelButtonLabel,
              style: const TextStyle(fontSize: 18),
            ),
          ),
        ),
        const SizedBox(
          height: 20,
          child: VerticalDivider(),
        ),
        Expanded(
          child: TextButton(
            style: TextButton.styleFrom(
              backgroundColor: context.colorScheme.primary,
              foregroundColor: context.colorScheme.onPrimary,
              shape: RoundedRectangleBorder(
                borderRadius: BorderRadius.circular(24.0),
              ),
            ),
            onPressed: onSavePressed,
            child: Text(
              localizations.okButtonLabel,
            ),
          ),
        ),
        const SizedBox(width: 14,),
      ],
    );
  }
}
